<head xmlns:th="https://www.thymeleaf.org" th:fragment="head"
th:with="description=${isPost ? post != null ? post.status.excerpt : singlePage != null ? singlePage.status.excerpt : site.seo.description : site.seo.description}">
  <meta charset="utf-8"/>
  <title th:text="${showTitle + (#strings.isEmpty(site.subtitle) ? '' : '|' + site.subtitle)}"></title>
  <script th:if="${theme.config.enhance.enable_sw}" th:src="${(theme.config.enhance.enable_sw == 'uninstall')? #theme.assets('/js/sw.min.js?uninstall=true') + '&mew=1.3.2' : '/sw.min.js?mew=1.3.2' + theme.config.enhance.enable_sw + '&cdn=' + theme.config.enhance.sw_cdn_source.replaceAll('\n', ',')}"></script>
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <meta name="applicable-device" content="pc,mobile">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="keywords" th:content="${site.seo.keywords}"/>
  <meta name="description" th:content="${description}">
  <meta name="author" th:content="${site.title}">
  <meta name="site" th:content="${site.url}">
  <meta name="referrer" th:content="${theme.config.basic_info.referrer_policy}">
  <meta http-equiv="Referrer-Policy" th:content="${theme.config.basic_info.referrer_policy}">
  <meta property="og:type" content="website">
  <meta property="og:title" th:content="${showTitle}">
  <meta property="og:url" th:content="${#strings.isEmpty(canonical) ? '' : #strings.startsWith(canonical, 'http') ? canonical : (site.url + canonical).replaceAll('(?<!:)//', '/')}">
  <meta property="og:site_name" th:content="${title}">
  <meta property="og:description" th:content="${description}">
  <meta property="og:locale" content="zh">
  <meta property="og:image" th:content="@{${#strings.isEmpty(site.favicon) ? '' : #strings.startsWith(site.favicon,'http') ? site.favicon : (site.url + site.favicon).replaceAll('(?<!:)//', '/')}}">
  <meta name="twitter:card" content="summary">
  <meta name="twitter:title" th:content="${showTitle}">
  <meta name="twitter:description" th:content="${description}">
  <meta name="twitter:image" th:content="@{${#strings.isEmpty(site.favicon) ? '' : #strings.startsWith(site.favicon,'http') ? site.favicon : (site.url + site.favicon).replaceAll('(?<!:)//', '/')}}">

  <th:block th:if="${theme.config.pwa.enable_pwa}">
    <link rel="manifest" th:href="${theme.config.pwa.manifest_file}"/>
    <link rel="apple-touch-icon" th:href="${theme.config.pwa.apple_touch_icon}">
    <meta name="theme-color" th:content="${theme.config.pwa.theme_color}"/>
    <meta name="mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" th:content="${theme.config.pwa.apple_status_bar_style}"/>
  </th:block>

  <link rel="canonical" th:href="${#strings.isEmpty(canonical) ? '' : #strings.startsWith(canonical, 'http') ? canonical : (site.url + canonical).replaceAll('(?<!:)//', '/')}"/>

  <link rel="preload stylesheet" as="style" th:href="@{/assets/css/theme.min.css(mew=${theme.spec.version})}">
  <link rel="preload stylesheet" as="style" th:href="@{/assets/lib/remixicon@4.7.0/remixicon.min.css}">
  <link rel="preload stylesheet" as="style" th:href="@{/assets/css/style.min.css(mew=${theme.spec.version})}">
  <link th:if="${theme.config.basic_style.theme_style == 'celebration'}" rel="preload stylesheet" as="style" th:href="@{/assets/css/celebration.min.css(mew=${theme.spec.version})}">

  <th:block th:if="${isPost}">
    <link data-pjax rel="preload stylesheet" as="style" th:href="@{/assets/css/post.min.css(mew=${theme.spec.version})}"/>
    <link th:if="${enableShare}" data-pjax rel="preload stylesheet" as="style" th:href="@{/assets/css/dshare.min.css(mew=${theme.spec.version})}"/>
  </th:block>

  <link rel="stylesheet" th:href="@{/assets/css/mew-custom.min.css(mew=${theme.spec.version})}">
  <link th:if="${isPost == true || isPhotos == true}" data-pjax rel="stylesheet" th:href="@{/assets/lib/fancybox@5.3.7/jquery.fancybox.min.css}">
  <link rel="stylesheet" th:href="@{/assets/lib/qmsg/qmsg.min.css}">

  <link th:if="${theme.config.enhance.cursor_style != 'none'}" rel="stylesheet" th:href="@{/assets/css/cursor.min.css(mew=${theme.spec.version})}">

  <th:block th:replace="~{common/config}"/>

  <script th:src="@{/assets/lib/jquery@3.5.1/jquery.min.js}"></script>

  <link th:if="${!#strings.isEmpty(theme.config.custom.external_css)}" rel="stylesheet" th:href="${theme.config.custom.external_css}">
  <style th:if="${!#strings.isEmpty(theme.config.custom.inline_css)}" type="text/css" th:utext="${theme.config.custom.inline_css}"></style>
  [(${theme.config.custom.external_js_head})]
  <script th:if="${!#strings.isEmpty(theme.config.custom.inline_js_head)}" type="text/javascript" th:utext="${theme.config.custom.inline_js_head}">
  </script>
</head>